const arr = [1, 2, [4, 5], 6, 7, [8]];
console.log(arr.flat())